home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIFileSpec.idl < prev    next >
Text File  |  2006-05-08  |  7KB  |  208 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  39.     THIS INTERFACE IS DEPRECATED AND UNSUPPORTED!  USE |nsIFile| and |nsILocalFile|.
  40.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  41.  
  42.  
  43. // This is the only correct cross-platform way to specify a file.
  44. // Strings are not such a way. If you grew up on windows or unix, you
  45. // may think they are. Welcome to reality.
  46.  
  47. #include "nsISupports.idl"
  48.  
  49. %{C++
  50. #include "nsFileSpec.h" // for factory method
  51. %}
  52.  
  53. interface nsIFileURL;
  54. interface nsIFilePath;
  55. interface nsIOutputStream;
  56. interface nsIInputStream;
  57.  
  58. // Define Contractid and CID
  59. %{C++
  60.  
  61. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
  62.     THIS INTERFACE IS DEPRECATED AND UNSUPPORTED!  USE |nsIFile| and |nsILocalFile|.
  63.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  64.  
  65. // {A5740FA2-146E-11d3-B00D-00C04FC2E79B} 
  66. #define NS_FILESPEC_CID \
  67. { 0xa5740fa2, 0x146e, 0x11d3, { 0xb0, 0xd, 0x0, 0xc0, 0x4f, 0xc2, 0xe7, 0x9b } }
  68.  
  69. #define NS_FILESPEC_CONTRACTID "@mozilla.org/filespec;1"
  70. #define NS_FILESPEC_CLASSNAME "File Spec"
  71.  
  72. %}
  73.  
  74.       native nsFileSpec(nsFileSpec);
  75. [ref] native nsFileSpecRef(nsFileSpec);
  76. [ptr] native nsFileSpecPtr(nsFileSpec);
  77.  
  78. [scriptable, uuid(37ef2e71-edef-46c7-acd9-f0b6e0b15083)]
  79. interface nsIFileSpec : nsISupports
  80. {
  81.     void fromFileSpec([const] in nsIFileSpec original);
  82.  
  83.     attribute string URLString;
  84.     attribute string unixStyleFilePath;
  85.     attribute string persistentDescriptorString;
  86.     attribute string nativePath;
  87.  
  88.     readonly attribute string NSPRPath;
  89.  
  90.     void error();
  91.  
  92.     boolean isValid();
  93.     boolean failed();
  94.  
  95.     attribute string leafName;
  96.  
  97.     readonly attribute nsIFileSpec parent;
  98.     readonly attribute nsIInputStream inputStream;
  99.     readonly attribute nsIOutputStream outputStream;
  100.     boolean isChildOf(in nsIFileSpec possibleParent);
  101.     [noscript] readonly attribute nsFileSpec fileSpec;
  102.     [noscript] void setFromFileSpec([const] in nsFileSpecRef spec);
  103.     
  104.     attribute string fileContents;
  105.  
  106.     void makeUnique();
  107.     void makeUniqueWithSuggestedName(in string suggestedName);
  108.  
  109.     void makeUniqueDir();
  110.     void makeUniqueDirWithSuggestedName(in string suggestedName);
  111.  
  112.     readonly attribute unsigned long modDate;
  113.     boolean modDateChanged(in unsigned long oldStamp);
  114.  
  115.     boolean isDirectory();
  116.     boolean isFile();
  117.     boolean exists();
  118.     boolean isHidden();
  119.  
  120.     boolean equals(in nsIFileSpec spec);
  121.  
  122.     readonly attribute unsigned long fileSize;
  123.     readonly attribute long long diskSpaceAvailable;
  124.  
  125.     void appendRelativeUnixPath(in string relativePath);
  126.  
  127.     void createDir();
  128.     void touch();
  129.     
  130.     boolean isSymlink();
  131.     void resolveSymlink();
  132.  
  133.     void delete(in boolean recursive);
  134.     void truncate(in long aNewLength);
  135.     void rename([const] in string newLeafName);
  136.     void copyToDir([const] in nsIFileSpec newParentDir);
  137.     void moveToDir([const] in nsIFileSpec newParentDir);
  138.     void execute([const] in string args);
  139.     
  140.     void openStreamForReading();
  141.     void openStreamForWriting();
  142.     void openStreamForReadingAndWriting();
  143.     void closeStream();
  144.     boolean isStreamOpen();
  145.     
  146.     boolean eof();
  147.     long read(inout string buffer, in long requestedCount);
  148.     void readLine(inout string line, in long bufferSize, out boolean wasTruncated);
  149.  
  150.     /** Check eof() before each call.
  151.      * CAUTION: false result only indicates line was truncated
  152.      * to fit buffer, or an error occurred (OTHER THAN eof).
  153.      */
  154.     long write(in string data, in long requestedCount);
  155.     void flush();
  156.     
  157.     void seek(in long offset);
  158.     long tell();
  159.     void endLine();
  160.     attribute AString unicodePath;
  161.     
  162. };
  163.     
  164. // Define Contractid and CID
  165. %{C++
  166. // {a3020981-2018-11d3-915f-a957795b7ebc}
  167. #define NS_DIRECTORYITERATOR_CID \
  168. { 0xa3020981, 0x2018, 0x11d3, { 0x91, 0x5f, 0xa9, 0x57, 0x79, 0x5b, 0x7e, 0xbc } }
  169.  
  170. #define NS_DIRECTORYITERATOR_CONTRACTID "@mozilla.org/directoryiterator;1"
  171. #define NS_DIRECTORYITERATOR_CLASSNAME "nsIDirectoryIterator"
  172. %}
  173.  
  174. [scriptable, uuid(d8c0a083-0868-11d3-915f-d9d889d48e3c)]
  175. interface nsIDirectoryIterator : nsISupports
  176. {
  177.     void init(in nsIFileSpec parent, in boolean resolveSymlink);
  178.     boolean exists();
  179.     void next();
  180.     readonly attribute nsIFileSpec currentSpec;
  181. };
  182.  
  183. %{C++
  184. // Factory methods if you link with xpcom
  185. NS_COM_OBSOLETE nsresult NS_NewFileSpecWithSpec(const nsFileSpec& aSrcFileSpec, nsIFileSpec **result);
  186. NS_COM_OBSOLETE nsresult NS_NewFileSpec(nsIFileSpec** result);
  187. NS_COM_OBSOLETE nsresult NS_NewDirectoryIterator(nsIDirectoryIterator** result);
  188.  
  189. // Convert from nsIFile to nsIFileSpec
  190. //
  191. // XXX This function is here only to assist with the migration from nsIFileSpec
  192. // to nsIFile.  This function will dissappear in future mozilla releases.
  193. //
  194. // ...ripped from nsPrefService.cpp:
  195. //
  196. //   "So discouraged is the use of nsIFileSpec, nobody wanted to have this routine be
  197. //    public - It might lead to continued use of nsIFileSpec. Right now, [mozilla] has
  198. //    such a need for it, here it is. Let's stop having to use it though."
  199. //
  200. NS_COM_OBSOLETE nsresult NS_NewFileSpecFromIFile(nsIFile *aFile, nsIFileSpec **result);
  201.  
  202. #define NS_BOOL_ACCESSOR(_method) { PRBool yes; return NS_SUCCEEDED(f->_method(&yes)) && yes; }
  203. inline PRBool Exists(nsIFileSpec* f) NS_BOOL_ACCESSOR(Exists)
  204. inline PRBool Exists(nsIDirectoryIterator* f) NS_BOOL_ACCESSOR(Exists)
  205. inline PRBool IsDirectory(nsIFileSpec* f) NS_BOOL_ACCESSOR(IsDirectory)
  206.  
  207. %}
  208.